package at.fhj.itm10.ticketmaster.entities;

/**
 * address model
 * 
 * @author stefan leisenberger
 */

public class Address implements Entity {

	private long id;
	private String name;
	private String street;
	private String zip;
	private String city;
	private String country;
	
	public Address(String name, String street, String zip, String city, String country) {
		this.setName(name);
		this.setStreet(street);
		this.setZip(zip);
		this.setCity(city);
		this.setCountry(country);
	}
	
	public Address() {
		// empty constructor
	}
	
	// getter and setter
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getStreet() {
		return street;
	}
	public void setStreet(String street) {
		this.street = street;
	}
	public String getZip() {
		return zip;
	}
	public void setZip(String zip) {
		this.zip = zip;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getCountry() {
		return country;
	}
	public void setCountry(String country) {
		this.country = country;
	}
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	
	/**
	 * {@inheritDoc}
	 * Returns a hashcode for the object.
	 * @return result
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (id ^ (id >>> 32));
		return result;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * Compare this object with another object.
	 * 
	 * @param obj
	 * @return boolean (true if the objects are identical). 
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Address other = (Address) obj;
		if (id != other.id)
			return false;
		return true;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * Returns a String with the current address.
	 * @return String
	 */
	@Override
	public String toString() {
		return "Address [id=" + id + ", name=" + name + ", street=" + street
				+ ", zip=" + zip + ", city=" + city + ", country=" + country
				+ "]";
	}
}
